<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <tr>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>商品数量</th>
    </tr>
</table>
<script>
    const arr=[
        {name:'小米手机',price:5000,num:100},
        {name:'华为手机',price:6000,num:200},
        {name:'苹果手机',price:7000,num:300},
        {name:'三星手机',price:8000,num:400},
        {name:'OPPO手机',price:9000,num:500},
    ]
    let table=document.querySelector('table');
    for(let i=0;i<arr.length;i++){
        let tr=document.createElement('tr');
        let td1=document.createElement('td');
        let td2=document.createElement('td');
        let td3=document.createElement('td');
        td1.innerHTML=arr[i].name;
        td2.innerHTML=arr[i].price;
        td3.innerHTML=arr[i].num;
        tr.append(td1,td2,td3);
        table.append(tr);
    }


</script>
</body>
</html>